/*
 * Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd.
 *
 * Author:     zhangbingyi <zhangbingyi@uniontech.com>
 *
 * Maintainer: zhangbingyi <zhangbingyi@uniontech.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once

#include "exefilesprotectioninfo.h"

#include <QObject>
#include <QVariant>

class DBusInvokerInterface;
class ExeFilesProtectionModel : public QObject
{
    Q_OBJECT
public:
    explicit ExeFilesProtectionModel(QObject *parent = nullptr);
    ~ExeFilesProtectionModel();

    // 执行保护模式
    int getExeFilesMode();

    // 查询执行保护列表
    void queryExeFilesList();
    // 添加执行文件
    void addExeFile(const QString &file);
    // 信任当前状态
    void trustCurrentStatus(const QString &file);
    // 删除保护文件
    void deleteTrustFiles(QStringList sFilePaths);

public Q_SLOTS:
    // 同步执行保护查询
    void acceptExeFilesList();
    // 设置执行保护模式
    void setExeFilesMode(int mode);

Q_SIGNALS:
    void sendExeFilesList(QList<ExeFilesInfo> infoList);

private:
    DBusInvokerInterface *m_monitorInvoker;
    DBusInvokerInterface *m_exeFilesDBusInter; // 执行保护服务接口
    QVariant m_sessionVar;
};
